<?php
	namespace app;

	use core\controller\RestUtils;
	use core\controller\RestRequest;
	class getUresList extends RestRequest
	{
		public function __construct ()
		{
			switch (self::getMethod()){
				case 'get':
					$user_list = getUserList();
					if (self::getHttpAccent() == 'json'){
						RestUtils::sendResponse(200, json_decode( $user_list), 'application/json');
					}elseif (self::getHttpAccent() == 'xml'){
				$options = array(
					'indent'    =>  '',
					'addDecl'   =>  FALSE,
					'rootName'  =>  $fc->getAction(),
					XML_SERIALIZER_OPTION_RETURN_RESULT => TRUE,
				);
				$serializer =   new XML_Serializer($options);
				RestUtils::sendResponse(200, $serializer->serialiaze($user_list), 'application/xml');
					}
					break;
				case 'post':
					$user = new User();
					$user->setFirstName($data->getData()->first_name);
					$user->save();
					RestUtils::sendResponse(201, $user->getId());
					break;
			}
		}
	}











